/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.playground.core.entity.boardgame.chesslikegame;

import com.playground.core.entity.boardgame.Board;

/**
 *
 * @author Tiago Peres
 */
public abstract class ChessLikeBoard extends Board{
    
    /**
     * Return the square at the given row and column. "Row" and "column" should 
     * be a values between 0 and 7, otherwise "InvalidArgumentException" is
     * thrown.
     * 
     * If at the specified position there's no square, null is returned. For
     * example, in a checkers game just the black positions of the boards are
     * actually valid squares.
     * 
     * @param row the row the square is occupying
     * @param column the column the square is occupying
     * @return the square at (row, column)
     */
    public ChessLikeSquare getSquareAt(int row, int column){
        if (row >= 0 && row < 8 && column >= 0 && column < 8){
            return (ChessLikeSquare) getSquareAt(row * 8 + column);
        }
        throw new IllegalArgumentException("row and column should be in the interval [0, 7]");
    }
}
